import type { Component } from "vue"

export function loadComponent(coms: any): Component | undefined {
  return (id: string) => {
    var path = `./module/${id}/index.vue`
      , m = coms[path]
    if (m) {
      return defineAsyncComponent(() => {
        return m().then((c: any) => c.default)
      })
    }
    return undefined
  }
}